﻿#region ExcuteHalconProc_MultiThread_Binary.cs
// ============================================================================
// This region will be filled automatically with data if you are working
// for example with Microsoft SourceSafe
//
// Purpose:          
// Specifics: 
// 
// Creation date:    2024/5/27 14:19:50
// Created by:       hao.chen
//
// $Author:        $
// $Date:          $
// $Revision:      $
// $History:       $
// $NoKeywords:    $
// 
// Copyright:      © 2024 YourCompanyName
//                 All Rights Reserved
// ============================================================================
#endregion

using NeuroCheck.PlugInLib.Base;
using System;
using System.Runtime.Serialization;

// TODO: Namespace - Modify the namespace to the project namespace
namespace CLVisionHalconNC620
{
    /// <summary>This file contains the code is necessary to serialize and deserialize the data
    /// of the plug-in check function "ExcuteHalconProc_MultiThread". This data are the base for storing and loading
    /// the plug-in check function data in the binary CHR-file (check routine file).
    /// </summary>
    /// <remarks>It is recommended to serialize only necessary data and none that is created at runtime.
    /// </remarks>
    [Serializable]
    public partial class ExcuteHalconProc_MultiThread
    {
        #region --- Event and delegate definitions ----------------------------
        #endregion ------------------------------------------------------------

        #region --- Private and public fields, except those wrapped by properties

        /// <summary>Current version of this class.
        /// History:
        /// 6.2.0.0 | 2018-10-25 (TODO: BinarySerialization - Set the version and creation date of this class, example: 6.2.0.0 | 2014-05-28)
        /// </summary>
        /// <remarks>
        /// - May not be the version from AssemblyInfo.cs, otherwise each serializable class will have the same version.
        /// </remarks>
        public static Version m_CurrentVersion = new Version(6, 2, 0, 0);
        /// <summary>Version of this class that has been serialized.
        /// </summary>
        /// <remarks>
        /// - On initializing this class is the same version like current version.
        /// </remarks>
        public static Version m_SerializationVersion = m_CurrentVersion;

        #endregion ------------------------------------------------------------

        #region --- Constructors, including static constructors ---------------

        /// <summary>Deserialization constructor.
        /// </summary>
        /// <param name="info">SerializationInfo.</param>
        /// <param name="context">StreamingContext.</param>
        /// <remarks>Please note that you have to deserialize every necessary object explicitly.
        /// </remarks>
        public ExcuteHalconProc_MultiThread(SerializationInfo info, StreamingContext context)
            : base(info, context)
        {
            m_SerializationVersion = (Version)info.GetValue("SerializationVersion", typeof(Version));

            // Verify the serialized class version
            // The minimum supported version is 6.2.0.0 and maximum the current version of this class. It is not the version from AssemblyInfo.cs.
            // This verification prevents the deserialization of data created by class version 6.2.1.0 if this code supports version 6.2.0.0 only.
            if ((m_SerializationVersion >= new Version(6, 2, 0, 0)) &&
                (m_SerializationVersion <= m_CurrentVersion))
            {
                // Version of this class is at least 6.2.0.0, this is OK
                // TODO: BinarySerialization - Deserialize check function parameters, uncomment or remove the line below.
                m_Parameters = (ExcuteHalconProc_MultiThreadParameter)info.GetValue("Parameters", typeof(ExcuteHalconProc_MultiThreadParameter));
                // TODO: BinarySerialization - Deserialize check function target values, uncomment or remove the line below.
                // m_TargetValues = (ExcuteHalconProc_MultiThreadTargetValue)info.GetValue("TargetValues", typeof(ExcuteHalconProc_MultiThreadTargetValue));
                // TODO: BinarySerialization - Deserialize other class members are needed.

            } // eof if
            else
            {
                string message = String.Format(Properties.GlobalResources.strVersionIsNotSupported,
                                               Properties.ExcuteHalconProc_MultiThreadResources.strCheckFunctionName,
                                               m_SerializationVersion.ToString(),
                                               m_CurrentVersion.ToString());
                NcPIUserException newEx = new NcPIUserException(message);
                throw newEx;

            } // eof else
        }

        #endregion ------------------------------------------------------------

        #region --- Instance public properties (and the private fields they wrap)
        #endregion ------------------------------------------------------------

        #region --- Instance public methods -----------------------------------
        #endregion ------------------------------------------------------------

        #region --- Static public methods and properties ----------------------
        #endregion ------------------------------------------------------------

        #region --- Methods in interfaces -------------------------------------

        /// <summary>Populates a SerializationInfo with the data needed to serialize the target object.
        /// </summary>
        /// <param name="info">SerializationInfo.</param>
        /// <param name="context">StreamingContext.</param>
        /// <remarks>Please note that you have to serialize every necessary object explicitly.
        /// </remarks>
        public override void GetObjectData(SerializationInfo info, StreamingContext context)
        {
            base.GetObjectData(info, context);
            m_SerializationVersion = m_CurrentVersion;
            info.AddValue("SerializationVersion", m_SerializationVersion);
            // TODO: BinarySerialization - Serialize check function parameters if present, uncomment or remove the line below.
           info.AddValue("Parameters", m_Parameters);
            // TODO: BinarySerialization - Serialize check function target values if present, uncomment or remove the line below.
            // info.AddValue("TargetValues", m_TargetValues);
            // TODO: BinarySerialization - Serialize other class members are needed.
        }

        #endregion ------------------------------------------------------------

        #region --- Private (helper) methods ----------------------------------
        #endregion ------------------------------------------------------------

    } // end of class
} // end of namespace